package pages;

import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.interactions.Actions;

import io.appium.java_client.MobileElement;
import io.appium.java_client.TouchAction;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import io.appium.java_client.touch.offset.PointOption;
import utils.BaseAction;

public class HomePage {

	private static AndroidDriver<AndroidElement> driver;
	private static BaseAction action;

	public HomePage(AndroidDriver<AndroidElement> driver) {
		this.driver = driver;
		this.action = new BaseAction(driver);
	}
	public static void click_system() throws InterruptedException {
		System.out.println("click_talk_system()-----------------------*****");
		Thread.sleep(5000);
		System.out.println("click_talk_system success");
		action.setXY(500, 300);
//		TouchAction action = new TouchAction(driver);
//        PointOption pointOption = new PointOption();
//        pointOption.withCoordinates(500,300);
//        action.tap(pointOption).perform().release();
		      
//		List<AndroidElement> list=driver.findElementsByClassName("android.view.View");
//		Thread.sleep(3000);
//		System.out.println(list.size());
//		list.get(0).click();
	}
	public static TalkPage clicksuccess() throws InterruptedException {
		System.out.println("clicksuccess------login");
		click_system();
		return new TalkPage(driver);
	} 

//	public AndroidElement add_item() {
//		return driver.findElementById("com.example.todolist:id/action_new");
//	}
//
//	public AndroidElement edit_content() {
//		return driver.findElementById("com.example.todolist:id/toDoItemDetailET");
//	}
//
//	public AndroidElement btn_save() {
//		return driver.findElementById("com.example.todolist:id/saveBtn");
//	}
//
//	public AndroidElement list_item0() {
//		AndroidElement list_view = (AndroidElement) driver.findElementById("com.example.todolist:id/todoListView");
//		List<MobileElement> items = list_view.findElements(By.className("android.widget.RelativeLayout"));
//		return (AndroidElement) items.get(0);
//	}
//	
//	public AndroidElement menu_delete() {
//		return driver.findElementById("android:id/title");
//	}
//
//	public AndroidElement dialog_ok() {
//		return driver.findElementById("android:id/button1");
//	}
//
//	
//
//	public void add(String content) throws InterruptedException {
//		action.click(add_item());
//		action.type(edit_content(), content);
//		action.click(this.btn_save());
//
//	}
//
//	public void del() throws InterruptedException {
//		action.longPress(this.list_item0());
//		action.click(this.menu_delete());
//		action.click(this.dialog_ok());
//	}

}
